
function setCookie(name,value,time)
{
    var strsec = getsec(time);
    var exp = new Date();
    exp.setTime(exp.getTime() + strsec*1);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getsec(str)
{
   ///alert(str);
   var str1=str.substring(1,str.length)*1;
   var str2=str.substring(0,1);
   if (str2=="s")
   {
        return str1*1000;
   }
   else if (str2=="h")
   {
       return str1*60*60*1000;
   }
   else if (str2=="d")
   {
       return str1*24*60*60*1000;
   }
} 

//读取cookies
function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
 
    if(arr=document.cookie.match(reg))
 
        return unescape(arr[2]);
    else
        return null;
}

//删除cookies
function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null)
        document.cookie= name + "="+cval+";expires="+exp.toGMTString();
} 



 function myFunction() {
            console.log('------11111111111111----------')
			var fh_load="1";
            setCookie("fh_load","1","d20");
            var date_end = $('#date_end1').val();
            setCookie("date_end",date_end,"d20");			
            var date_start = $('#date_start1').val();
            setCookie("date_start",date_start,"d20");			
            var dep_data = $("#dep_data").val();			
            setCookie("dep_data",dep_data,"d20");
            //getCookie("fh_load");			
            var pdf = new jsPDF();
            var options = {
                pagesplit: false
            };
        
            /*
            fhlength=document.getElementsByTagName("body")[0].style.height.length-2;
			console.log('-fhheight0000-',document.getElementsByTagName("body")[0].style.height)						
			console.log('-fhheight0001-',document.getElementsByTagName("body")[0].style.height.length)			
			console.log('-fhheight0002-',fhlength)			
			var fhheight=document.getElementsByTagName("body")[0].style.height.substring(0,fhlength)			
			console.log('-fhheight111-',fhheight)			
						
			var height=parseInt(fhheight)-100
			console.log('-fhheight222-',height)	
			
			var fhheight2=height.toString()+"px";
			console.log('-fhheight333-',fhheight2)	
			*/
			
            $('#ol_article_content').css({
                "background-color": "white",
				"width":document.getElementsByTagName("body")[0].style.width,
				"height":document.getElementsByTagName("body")[0].style.height,			
            });

            pdf.addHTML($('#ol_article_content'), options, function () {
				
                pdf.save('web.pdf');
            });


}
		
		
		
		